package com.eattoo.artimisdemo.controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServletRequest;
/*主程序类*/
@SpringBootApplication
/*@ResponseBody直接写给浏览器(如果是对象转为json数据);RestController==ResponeseBody+Controller*/
@Controller
public class ArtimisDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(ArtimisDemoApplication.class, args);
    }

    @RequestMapping("/index")
    public String index(){return "index";}
    /*springboot默认jar包模式嵌入tomcat，不支持jsp(可以使用模板引擎)*/
    @RequestMapping(value = "/toPage",method = RequestMethod.GET)
    public String toPage(HttpServletRequest request){
        String url = request.getParameter("url");
        return url;
    }

}
